package com.powergisol.gis.controller;

import com.powergisol.gis.entity.TabUser;
import com.powergisol.gis.service.TabUserService;
import com.powergisol.gis.util.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.security.Principal;
import java.util.ArrayList;
import java.util.List;

/**
 * Description:用户同步
 */
@RestController
@RequestMapping("tabUser")
@Api(description = "用户管理" ,value = "用户管理")
public class UserController {
    @Autowired
    private TabUserService tabUserService;

    @PostMapping("synUser")
    public Result synUser(@Valid @RequestBody List<TabUser> entitys){
        return tabUserService.synUser(entitys);
    }
    @PostMapping("upPassword")
    public Result upPassword(String oldPassword,String newPassword, Principal p){
        return tabUserService.upPassword(oldPassword,newPassword,p.getName());
    }
}
